﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using PlugNT.Cms.BLL;
using PlugNT.Cms.Page;

namespace PlugNT.Cms.Web.Admin
{
    public partial class ModifyPass : AdminPage
    {
        private Adminer curAdminer = new Adminer();
        protected void Page_Load(object sender, EventArgs e)
        {
            //权限检测
            this.CheckPower();

        }

        protected void Button_update_Click(object sender, EventArgs e)
        {
            if (txtRePass.Text.Trim() == txtNewPass.Text.Trim())
            {
                if (curAdminer.ModifyPass(base.adminer.name, curAdminer.MD5Hasher(txtOldPass.Text.Trim()), curAdminer.MD5Hasher(txtNewPass.Text.Trim())))
                {
                    Response.Redirect("./Message.aspx?message=密码修改成功！&z=yes");
                }
                else
                {
                    Response.Redirect("./Message.aspx?message=密码修改失败，原密码错误！&z=no");
                }
            }
            else
            {
                Response.Redirect("./Message.aspx?message=密码修改失败，原密码和新密码不一致！&z=no");
            }
        }
    }
}
